<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登陆成功</title>
<script src="${pageContext.request.contextPath }/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath }/js/jquery-ui.min.js"></script>
 <link rel="stylesheet" href="${pageContext.request.contextPath }/css/jquery-ui.min.css">
<script type="text/javascript">
	var user = "${sessionScope.user}";
	if(user==null||user==''){
		window.location.href="login.jsp";
	}
	
	function actionStart(){
		var autoBut = document.getElementById("autoBut").value;
		var selectedObj = document.getElementsByName("areaNum");
		var count = 0;
		for(var i=0;i<selectedObj.length;i++){
			if(selectedObj[i].checked){
				count = count + 1;
			}
		}
		
		if(count==0){
			alert("请选择区");
			return;
		}
		if(autoBut=="启动采集"){
			document.getElementById("autoBut").value = "停止采集";
			document.getElementById("actionType").value = "1";
		}else{
			document.getElementById("autoBut").value = "启动采集";
			document.getElementById("actionType").value = "0";
		}
		
		$.ajax({
			url : '${pageContext.request.contextPath}/autoRunServer',
			data : $("#actionForm").serialize(),
			type : "POST",
			async : false,
			success : function (msg){
				alert(msg);
			}
		});
		
		if(autoBut=="启动采集"){
			document.getElementById("autoBut").value = "停止采集";
		}else{
			document.getElementById("autoBut").value = "启动采集";
		}
		
	}
	
	$(function() {
	    $("#datepicker").datepicker();
	    $("#datepicker").datepicker("option","dateFormat","yy-mm-dd");
	    $("#datepicker").val("<%= cn.data.collection.util.DateUtils.plusDateWithoutWeekend(-1, null)%>");
	});
	
</script>
</head>
<body>
	<form action="${pageContext.request.contextPath }/autoRunServer" method="post" id="actionForm">
		<input type="hidden" id="actionType" name="actionType" value="<%= cn.data.collection.constant.CollectionParaConstant.autoRunFlag==true?1:0%>"/>
		<table width="100%" height="100%">
			<tr height="300">
				<td></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<td></td>
				<td align="center">
					<table height="100%" align="center" style="border:1px solid #f7900f;background-color:#fff1cc;height:25px;">
					<tr>
						<td>
						采集日期<input type="text" name="collectDate" value="" size="5" readonly="readonly"  id="datepicker"/></td>
						</td>
					</tr>
					</table>
			</tr>
			<tr>
				<td></td>
				<td align="center">
					<table height="100%" align="center" style="border:1px solid #f7900f;background-color:#fff1cc;height:25px;">
						<tr>
							<td>采集区域</td>
						</tr>
						<tr>
							<td>
								省级:<input type="checkbox" name="areaNum" value="01" checked="checked"/>
								荔湾:<input type="checkbox" name="areaNum" value="03" checked="checked"/>
							</td>
						</tr>
						<tr>
							<td>
								越秀:<input type="checkbox" name="areaNum" value="04" checked="checked"/>
								海珠:<input type="checkbox" name="areaNum" value="05" checked="checked"/>
							</td>
						</tr>
						<tr>
							<td>
								天河:<input type="checkbox" name="areaNum" value="06" checked="checked"/>
								萝岗:<input type="checkbox" name="areaNum" value="08" checked="checked"/>
							</td>
						</tr>
						<tr>
							<td>
								南沙:<input type="checkbox" name="areaNum" value="10" checked="checked"/>
								白云:<input type="checkbox" name="areaNum" value="11" checked="checked"/>
							</td>
						</tr>
						<tr>
							<td>
								黄埔:<input type="checkbox" name="areaNum" value="12" checked="checked"/>
								花都:<input type="checkbox" name="areaNum" value="21" checked="checked"/>
							</td>
						</tr>
						<tr>
							<td>
								从化:<input type="checkbox" name="areaNum" value="22" checked="checked"/>
								增城:<input type="checkbox" name="areaNum" value="25" checked="checked"/>
							</td>
						</tr>
						<tr>
							<td>
								番禺:<input type="checkbox" name="areaNum" value="26" checked="checked"/>
							</td>
						</tr>
						<tr>
							<td></td>
						</tr>
					</table>
				</td>
				<td>
				</td>
			</tr>
			<tr>
				<td></td>
				<td align="center">
					<table height="100%" align="center" style="border:1px solid #f7900f;background-color:#fff1cc;height:25px;">
					<tr>
						<td>
						模式&nbsp;
							<select name="collectionType">
								<option value="1">简易模式</option>
								<option value="2">扑捕模式</option>
							</select>
						</td>
					</tr>
					</table>
			</tr>
			<tr>
				<td></td>
				<td align="center">
					<input type="button" value="<%= cn.data.collection.constant.CollectionParaConstant.autoRunFlag==true?"停止采集":"启动采集" %>" onclick="actionStart();" id="autoBut"/>
				</td>
				<td></td>
			</tr>
		</table>
	</form>
</body>
</html>